import { Component, OnInit, Input, OnDestroy, SimpleChanges } from '@angular/core';
import {TagData} from "../../../../entity/tag-data.model";
import {
  trigger, // 动画封装触发，外部的触发器
  state, // 转场状态控制
  style, // 用来书写基本的样式
  transition, // 用来实现css3的 transition
  animate, // 用来实现css3的animations
  keyframes // 用来实现css3 keyframes的
} from '@angular/animations';
import {
  TurbstatusPanelComponent,
  TurbstatusData,
  TurbstatusTable,
  TurbstatusRow,
  TurbstatusColumn
} from "../turbstatus-panel/turbstatus-panel.component";
import { TurboperCategoryService } from "../../../../service/turboper-category.service";

import { fadeIn } from "../../../../../platform/zknwui/core/common/animation/fadeIn-animation";

@Component({
  selector: 'app-turboper-panel',
  templateUrl: './turboper-panel.component.html',
  styleUrls: ['./turboper-panel.component.css'],
  animations: [fadeIn]

})
export class TurboperPanelComponent implements OnInit, OnDestroy {
  /**
   * 检修标题
   * 
   * @type {string}
   * @memberof TurboperPanelComponent
   */
  @Input()
  public title: string = "风机检修";

  /**
   * 风机操作统计
   * 
   * @type {TurbstatusData[]}@memberof TurbstatusPanelComponent
   */
  @Input()
  public totalTurboperDatas: TurboperData[];

  /**
  * 风机操作统计明细
  * 
  * @type {TurbstatusData[]}@memberof TurbstatusPanelComponent
  */
  @Input()
  public turboperTable: TurbstatusTable;
  

  public powerShow: boolean = false;
  @Input() 
  public maxValue: number;
  constructor(
  ) { }
  ngOnChanges(changes: SimpleChanges) {
     if (changes['totalTurboperDatas'] && changes['totalTurboperDatas'].currentValue) {
     
    } 

  }
  ngOnInit() {

    // this.turboperCategoryService.getTurboperCategoryWithTotalTurbine()
    //   .then(res=>{
    //     this.turboperCategorys = [...res];
    //    }).catch(error => {
    //     throw new Error(error);
    //   }); 
    // this.turboperCategoryService.getTurboperCategoryWithTotalTurbine()
    //   .then(res=>{
    //     this.turboperCategorys = [...res];
    //    }).catch(error => {
    //     throw new Error(error);
    //   });         
  }

  ngOnDestroy(): void {
  }

  enterPower() {
    this.powerShow = true;
  }
  leavePower() {
    this.powerShow = false;
  }
}
export interface TurboperData {
  id: number;
  name: string;
  color: string;
  value: number;
}
export interface TurboperTable {
  rows: TurboperRow[];
  title:string[];
}
export interface TurboperRow {
  columns: TurboperColumn[];
  farmName:string;
  farmId:number;
}
export interface TurboperColumn {
  value: any,
  color?: string,
  operId?: number,
  farmId?: number,
  turbineState?:TagData[]
}






// WEBPACK FOOTER //
// ./src/app/module/monitor/main/turboper-panel/turboper-panel.component.ts